<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>blmc_robots: /workspace/software/workspace/src/catkin/robots/blmc_robots/include/blmc_robots/blmc_joint_module.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">blmc_robots
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('blmc__joint__module_8hpp_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">blmc_joint_module.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="blmc__joint__module_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;array&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;stdexcept&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;math.h&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;Eigen/Eigen&gt;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &quot;blmc_drivers/devices/motor.hpp&quot;</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="common__header_8hpp.html">blmc_robots/common_header.hpp</a>&quot;</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceblmc__robots.html">blmc_robots</a></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;{</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">// TODO what is the best scope for those homing-related types?</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6">   28</a></span>&#160;<span class="keyword">enum class</span> <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6">HomingReturnCode</a> {</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6a02de9649e258d1dd94056e676061e969">NOT_INITIALIZED</a> = 0,</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6a43491564ebcfd38568918efbd6e840fd">RUNNING</a>,</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6afd9f6519d3f45276829fe74eb2c4bb85">SUCCEEDED</a>,</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6ab9e14d9b2886bcff408b85aefa780419">FAILED</a></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;};</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="structblmc__robots_1_1HomingState.html">   43</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structblmc__robots_1_1HomingState.html">HomingState</a> {</div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="structblmc__robots_1_1HomingState.html#a61557c9cbddb3183ccccafc456a1a00f">   45</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structblmc__robots_1_1HomingState.html#a61557c9cbddb3183ccccafc456a1a00f">joint_id</a>;</div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="structblmc__robots_1_1HomingState.html#a3ce572a7b025bbdf1eaaa5b72dc11dde">   47</a></span>&#160;    <span class="keywordtype">double</span> <a class="code" href="structblmc__robots_1_1HomingState.html#a3ce572a7b025bbdf1eaaa5b72dc11dde">search_distance_limit_rad</a>;</div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="structblmc__robots_1_1HomingState.html#ad8ffa51d7885e6e83dd4b32354184175">   49</a></span>&#160;    <span class="keywordtype">double</span> <a class="code" href="structblmc__robots_1_1HomingState.html#ad8ffa51d7885e6e83dd4b32354184175">home_offset_rad</a>;</div><div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="structblmc__robots_1_1HomingState.html#a06b1c01870f9531cbe766728603f468b">   51</a></span>&#160;    <span class="keywordtype">double</span> <a class="code" href="structblmc__robots_1_1HomingState.html#a06b1c01870f9531cbe766728603f468b">profile_step_size_rad</a>;</div><div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="structblmc__robots_1_1HomingState.html#a770422e8764a847278e5353e2ebe57a6">   53</a></span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">int</span> <a class="code" href="structblmc__robots_1_1HomingState.html#a770422e8764a847278e5353e2ebe57a6">last_encoder_index_time_index</a>;</div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="structblmc__robots_1_1HomingState.html#a16adc4753efe03def5ef3ebf7abc632c">   55</a></span>&#160;    uint32_t <a class="code" href="structblmc__robots_1_1HomingState.html#a16adc4753efe03def5ef3ebf7abc632c">step_count</a>;</div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="structblmc__robots_1_1HomingState.html#a72a681755f52b727ddca35e3811fa5f5">   57</a></span>&#160;    <span class="keywordtype">double</span> <a class="code" href="structblmc__robots_1_1HomingState.html#a72a681755f52b727ddca35e3811fa5f5">target_position_rad</a>;</div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="structblmc__robots_1_1HomingState.html#af821e232c974385ae24e20a7f75665f7">   59</a></span>&#160;    <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6">HomingReturnCode</a> <a class="code" href="structblmc__robots_1_1HomingState.html#af821e232c974385ae24e20a7f75665f7">status</a>;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;};</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModule.html">   69</a></span>&#160;<span class="keyword">class </span><a class="code" href="classblmc__robots_1_1BlmcJointModule.html">BlmcJointModule</a></div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;{</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <a class="code" href="classblmc__robots_1_1BlmcJointModule.html">BlmcJointModule</a>(std::shared_ptr&lt;blmc_drivers::MotorInterface&gt; motor,</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;                    <span class="keyword">const</span> <span class="keywordtype">double</span>&amp; motor_constant,</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;                    <span class="keyword">const</span> <span class="keywordtype">double</span>&amp; gear_ratio,</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;                    <span class="keyword">const</span> <span class="keywordtype">double</span>&amp; zero_angle,</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;                    <span class="keyword">const</span> <span class="keywordtype">bool</span>&amp; reverse_polarity=<span class="keyword">false</span>,</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;                    <span class="keyword">const</span> <span class="keywordtype">double</span>&amp; max_current=2.1);</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    <span class="keywordtype">void</span> set_torque(<span class="keyword">const</span> <span class="keywordtype">double</span>&amp; desired_torque);</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    <span class="keywordtype">void</span> set_zero_angle(<span class="keyword">const</span> <span class="keywordtype">double</span>&amp; zero_angle);</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keywordtype">void</span> send_torque();</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <span class="keywordtype">double</span> get_sent_torque() <span class="keyword">const</span>;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    <span class="keywordtype">double</span> get_measured_torque() <span class="keyword">const</span>;</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    <span class="keywordtype">double</span> get_measured_angle() <span class="keyword">const</span>;</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    <span class="keywordtype">double</span> get_measured_velocity() <span class="keyword">const</span>;</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    <span class="keywordtype">double</span> get_measured_index_angle() <span class="keyword">const</span>;</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    <span class="keywordtype">double</span> get_zero_angle() <span class="keyword">const</span>;</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    <span class="keywordtype">void</span> set_position_control_gains(<span class="keywordtype">double</span> kp, <span class="keywordtype">double</span> kd);</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;    <span class="keywordtype">double</span> execute_position_controller(<span class="keywordtype">double</span> target_position_rad) <span class="keyword">const</span>;</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    <span class="keywordtype">bool</span> calibrate(<span class="keywordtype">double</span>&amp; angle_zero_to_index,</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;                   <span class="keywordtype">double</span>&amp; index_angle,</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;                   <span class="keywordtype">bool</span> mechanical_calibration = <span class="keyword">false</span>);</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;    <span class="keywordtype">void</span> init_homing(<span class="keywordtype">int</span> joint_id, <span class="keywordtype">double</span> search_distance_limit_rad, <span class="keywordtype">double</span></div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;            home_offset_rad, <span class="keywordtype">double</span> profile_step_size_rad=0.001);</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;</div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;    <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6">HomingReturnCode</a> update_homing();</div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;</div><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    <span class="keywordtype">double</span> joint_torque_to_motor_current(<span class="keywordtype">double</span> torque) <span class="keyword">const</span>;</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;</div><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;    <span class="keywordtype">double</span> motor_current_to_joint_torque(<span class="keywordtype">double</span> current) <span class="keyword">const</span>;</div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;</div><div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;    <span class="keywordtype">double</span> get_motor_measurement(<span class="keyword">const</span> <a class="code" href="namespaceblmc__robots.html#a1975c6bb47bc85dfc8edfe349c30dae1">mi</a>&amp; measurement_id) <span class="keyword">const</span>;</div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">int</span> get_motor_measurement_index(<span class="keyword">const</span> <a class="code" href="namespaceblmc__robots.html#a1975c6bb47bc85dfc8edfe349c30dae1">mi</a>&amp; measurement_id) <span class="keyword">const</span>;</div><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;</div><div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;    std::shared_ptr&lt;blmc_drivers::MotorInterface&gt; motor_;</div><div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;</div><div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;    <span class="keywordtype">double</span> motor_constant_;</div><div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;    <span class="keywordtype">double</span> gear_ratio_;</div><div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;    <span class="keywordtype">double</span> zero_angle_;</div><div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;    <span class="keywordtype">double</span> polarity_;</div><div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;    <span class="keywordtype">double</span> max_current_;</div><div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;</div><div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;    <span class="keywordtype">double</span> position_control_gain_p_;</div><div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;    <span class="keywordtype">double</span> position_control_gain_d_;</div><div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;</div><div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;    <span class="keyword">struct </span><a class="code" href="structblmc__robots_1_1HomingState.html">HomingState</a> homing_state_;</div><div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;};</div><div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;</div><div class="line"><a name="l00312"></a><span class="lineno"><a class="line" href="namespaceblmc__robots.html#aa5066dce11e2e3ae56b844676b132a09">  312</a></span>&#160;<span class="keyword">typedef</span> std::shared_ptr&lt;BlmcJointModule&gt; <a class="code" href="namespaceblmc__robots.html#aa5066dce11e2e3ae56b844676b132a09">BlmcJointModule_ptr</a>;</div><div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;</div><div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;<span class="keyword">template</span> &lt;<span class="keywordtype">int</span> COUNT&gt;</div><div class="line"><a name="l00321"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html">  321</a></span>&#160;<span class="keyword">class </span><a class="code" href="classblmc__robots_1_1BlmcJointModules.html">BlmcJointModules</a></div><div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;{</div><div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00328"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#abaff382c6fd4b494ec0c17498d94919e">  328</a></span>&#160;    <span class="keyword">typedef</span> Eigen::Matrix&lt;double, COUNT, 1&gt; <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#abaff382c6fd4b494ec0c17498d94919e">Vector</a>;</div><div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;</div><div class="line"><a name="l00338"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#a74910d81a89f9b1713ce8fecc69191fe">  338</a></span>&#160;    <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#a74910d81a89f9b1713ce8fecc69191fe">BlmcJointModules</a>(</div><div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;        <span class="keyword">const</span> std::array&lt;std::shared_ptr&lt;blmc_drivers::MotorInterface&gt;, COUNT&gt;&amp;</div><div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;          motors,</div><div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;        <span class="keyword">const</span> Vector&amp; motor_constants,</div><div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;        <span class="keyword">const</span> Vector&amp; gear_ratios,</div><div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;        <span class="keyword">const</span> Vector&amp; zero_angles,</div><div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;        <span class="keyword">const</span> Vector&amp; max_currents)</div><div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;    {</div><div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;        set_motor_array(motors, motor_constants, gear_ratios, zero_angles, max_currents);</div><div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;    }</div><div class="line"><a name="l00351"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#af4c700a8d346ceaebece38928b5e7ca6">  351</a></span>&#160;    <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#af4c700a8d346ceaebece38928b5e7ca6">BlmcJointModules</a>()</div><div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;    {</div><div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;    }</div><div class="line"><a name="l00362"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#a905addfe3271be5bc88bd785c5cbb032">  362</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#a905addfe3271be5bc88bd785c5cbb032">set_motor_array</a>(</div><div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;        <span class="keyword">const</span> std::array&lt;std::shared_ptr&lt;blmc_drivers::MotorInterface&gt;, COUNT&gt;&amp;</div><div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;          motors,</div><div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;        <span class="keyword">const</span> Vector&amp; motor_constants,</div><div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;        <span class="keyword">const</span> Vector&amp; gear_ratios,</div><div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;        <span class="keyword">const</span> Vector&amp; zero_angles,</div><div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;        <span class="keyword">const</span> Vector&amp; max_currents)</div><div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;    {</div><div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;        {</div><div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;            modules_[i] = std::make_shared&lt;BlmcJointModule&gt;(motors[i],</div><div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;                                                            motor_constants[i],</div><div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;                                                            gear_ratios[i],</div><div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;                                                            zero_angles[i],</div><div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;                                                            <span class="keyword">false</span>,</div><div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;                                                            max_currents[i]);</div><div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;        }</div><div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;    }</div><div class="line"><a name="l00383"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#a26d4d675142bc783c1f983d135a41a09">  383</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#a26d4d675142bc783c1f983d135a41a09">send_torques</a>()</div><div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;    {</div><div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;        {</div><div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;            modules_[i]-&gt;send_torque();</div><div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;        }</div><div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;    }</div><div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;</div><div class="line"><a name="l00396"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#ac7dba81727847238fc4c42b7dca6a0ea">  396</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#ac7dba81727847238fc4c42b7dca6a0ea">set_torques</a>(<span class="keyword">const</span> Vector&amp; desired_torques)</div><div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;    {</div><div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;        {</div><div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;            modules_[i]-&gt;set_torque(desired_torques(i));</div><div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;        }</div><div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;    }</div><div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;</div><div class="line"><a name="l00409"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#a9c71bc7db0ff4cd08bc2686a244caa65">  409</a></span>&#160;    Vector <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#a9c71bc7db0ff4cd08bc2686a244caa65">get_sent_torques</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;        Vector torques;</div><div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;</div><div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;        {</div><div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;            torques(i) = modules_[i]-&gt;get_sent_torque();</div><div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;        }</div><div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160;        <span class="keywordflow">return</span> torques;</div><div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;    }</div><div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;</div><div class="line"><a name="l00425"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#aeefc9487da9aafde41da790968a8165e">  425</a></span>&#160;    Vector <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#aeefc9487da9aafde41da790968a8165e">get_measured_torques</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;        Vector torques;</div><div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;</div><div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;        {</div><div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;            torques(i) = modules_[i]-&gt;get_measured_torque();</div><div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;        }</div><div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;        <span class="keywordflow">return</span> torques;</div><div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;    }</div><div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;</div><div class="line"><a name="l00441"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#af739948e89e5192eb853c7c5dcb9e87f">  441</a></span>&#160;    Vector <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#af739948e89e5192eb853c7c5dcb9e87f">get_measured_angles</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160;        Vector positions;</div><div class="line"><a name="l00444"></a><span class="lineno">  444</span>&#160;</div><div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;        {</div><div class="line"><a name="l00447"></a><span class="lineno">  447</span>&#160;            positions(i) = modules_[i]-&gt;get_measured_angle();</div><div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;        }</div><div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160;        <span class="keywordflow">return</span> positions;</div><div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;    }</div><div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;</div><div class="line"><a name="l00457"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#a87320890796f67050faa4fa506d5142d">  457</a></span>&#160;    Vector <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#a87320890796f67050faa4fa506d5142d">get_measured_velocities</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00458"></a><span class="lineno">  458</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00459"></a><span class="lineno">  459</span>&#160;        Vector velocities;</div><div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;</div><div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;        {</div><div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;            velocities(i) = modules_[i]-&gt;get_measured_velocity();</div><div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;        }</div><div class="line"><a name="l00465"></a><span class="lineno">  465</span>&#160;        <span class="keywordflow">return</span> velocities;</div><div class="line"><a name="l00466"></a><span class="lineno">  466</span>&#160;    }</div><div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;</div><div class="line"><a name="l00474"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#abc94960666d33b6a5071d4cf25f7794d">  474</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#abc94960666d33b6a5071d4cf25f7794d">set_zero_angles</a>(<span class="keyword">const</span> Vector&amp; zero_angles)</div><div class="line"><a name="l00475"></a><span class="lineno">  475</span>&#160;    {</div><div class="line"><a name="l00476"></a><span class="lineno">  476</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;        {</div><div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;            modules_[i]-&gt;set_zero_angle(zero_angles(i));</div><div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;        }</div><div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;    }</div><div class="line"><a name="l00487"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#a4ca83d65d009aaafe4522d431490bb1d">  487</a></span>&#160;    Vector <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#a4ca83d65d009aaafe4522d431490bb1d">get_zero_angles</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;        Vector positions;</div><div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;</div><div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160;        {</div><div class="line"><a name="l00493"></a><span class="lineno">  493</span>&#160;            positions(i) = modules_[i]-&gt;get_zero_angle();</div><div class="line"><a name="l00494"></a><span class="lineno">  494</span>&#160;        }</div><div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;        <span class="keywordflow">return</span> positions;</div><div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;    }</div><div class="line"><a name="l00503"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#a0ef05c89eeb1ffde131f44d4f3a300c8">  503</a></span>&#160;    Vector <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#a0ef05c89eeb1ffde131f44d4f3a300c8">get_measured_index_angles</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00505"></a><span class="lineno">  505</span>&#160;        Vector index_angles;</div><div class="line"><a name="l00506"></a><span class="lineno">  506</span>&#160;</div><div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160;        {</div><div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;            index_angles(i) = modules_[i]-&gt;get_measured_index_angle();</div><div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160;        }</div><div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;        <span class="keywordflow">return</span> index_angles;</div><div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160;    }</div><div class="line"><a name="l00513"></a><span class="lineno">  513</span>&#160;</div><div class="line"><a name="l00521"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#ada76994634fd0f15fb5df311a61e97d7">  521</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#ada76994634fd0f15fb5df311a61e97d7">set_position_control_gains</a>(<span class="keywordtype">size_t</span> joint_id, <span class="keywordtype">double</span> kp, <span class="keywordtype">double</span> kd)</div><div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;    {</div><div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;        modules_[joint_id]-&gt;set_position_control_gains(kp, kd);</div><div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160;    }</div><div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;</div><div class="line"><a name="l00532"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#a524fd41f808027190d59460a4787aea6">  532</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#a524fd41f808027190d59460a4787aea6">set_position_control_gains</a>(Vector kp, Vector kd)</div><div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;    {</div><div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;        {</div><div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160;           set_position_control_gains(i, kp[i], kd[i]);</div><div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160;        }</div><div class="line"><a name="l00538"></a><span class="lineno">  538</span>&#160;    }</div><div class="line"><a name="l00539"></a><span class="lineno">  539</span>&#160;</div><div class="line"><a name="l00555"></a><span class="lineno"><a class="line" href="classblmc__robots_1_1BlmcJointModules.html#ab6a642e6939b8587189502e4b179fdcf">  555</a></span>&#160;    <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6">HomingReturnCode</a> <a class="code" href="classblmc__robots_1_1BlmcJointModules.html#ab6a642e6939b8587189502e4b179fdcf">execute_homing</a>(<span class="keywordtype">double</span> search_distance_limit_rad,</div><div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160;            Vector home_offset_rad,</div><div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;            <span class="keywordtype">double</span> profile_step_size_rad=0.001)</div><div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;    {</div><div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;        <span class="comment">// Initialise homing for all joints</span></div><div class="line"><a name="l00560"></a><span class="lineno">  560</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00561"></a><span class="lineno">  561</span>&#160;        {</div><div class="line"><a name="l00562"></a><span class="lineno">  562</span>&#160;            modules_[i]-&gt;init_homing((<span class="keywordtype">int</span>) i, search_distance_limit_rad,</div><div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;                    home_offset_rad[i], profile_step_size_rad);</div><div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;        }</div><div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160;</div><div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;        <span class="comment">// run homing for all joints until all of them are done</span></div><div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;        real_time_tools::Spinner spinner;</div><div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;        spinner.set_period(0.001);  <span class="comment">// TODO magic number</span></div><div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;        <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6">HomingReturnCode</a> homing_status;</div><div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160;        <span class="keywordflow">do</span> {</div><div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;            <span class="keywordtype">bool</span> all_succeeded = <span class="keyword">true</span>;</div><div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160;            homing_status = <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6a43491564ebcfd38568918efbd6e840fd">HomingReturnCode::RUNNING</a>;</div><div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;</div><div class="line"><a name="l00574"></a><span class="lineno">  574</span>&#160;            <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i = 0; i &lt; COUNT; i++)</div><div class="line"><a name="l00575"></a><span class="lineno">  575</span>&#160;            {</div><div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160;                <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6">HomingReturnCode</a> joint_result = modules_[i]-&gt;update_homing();</div><div class="line"><a name="l00577"></a><span class="lineno">  577</span>&#160;</div><div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160;                all_succeeded &amp;= (joint_result == <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6afd9f6519d3f45276829fe74eb2c4bb85">HomingReturnCode::SUCCEEDED</a>);</div><div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160;</div><div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;                <span class="keywordflow">if</span> (joint_result == <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6a02de9649e258d1dd94056e676061e969">HomingReturnCode::NOT_INITIALIZED</a> ||</div><div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;                        joint_result == <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6ab9e14d9b2886bcff408b85aefa780419">HomingReturnCode::FAILED</a>) {</div><div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;                    homing_status = joint_result;</div><div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160;                    <span class="comment">// abort homing</span></div><div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;                    <span class="keywordflow">break</span>;</div><div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160;                }</div><div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160;            }</div><div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160;</div><div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160;            <span class="keywordflow">if</span> (all_succeeded) {</div><div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;                homing_status = <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6afd9f6519d3f45276829fe74eb2c4bb85">HomingReturnCode::SUCCEEDED</a>;</div><div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;            }</div><div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160;</div><div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;            spinner.spin();</div><div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;        } <span class="keywordflow">while</span> (homing_status == <a class="code" href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6a43491564ebcfd38568918efbd6e840fd">HomingReturnCode::RUNNING</a>);</div><div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;</div><div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;        <span class="keywordflow">return</span> homing_status;</div><div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;    }</div><div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;</div><div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;</div><div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;</div><div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;</div><div class="line"><a name="l00601"></a><span class="lineno">  601</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;    std::array&lt;std::shared_ptr&lt;BlmcJointModule&gt;, COUNT&gt; modules_;</div><div class="line"><a name="l00606"></a><span class="lineno">  606</span>&#160;};</div><div class="line"><a name="l00607"></a><span class="lineno">  607</span>&#160;</div><div class="line"><a name="l00608"></a><span class="lineno">  608</span>&#160;</div><div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160;</div><div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160;</div><div class="line"><a name="l00611"></a><span class="lineno">  611</span>&#160;</div><div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160;} <span class="comment">// namespace blmc_robots</span></div><div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_abaff382c6fd4b494ec0c17498d94919e"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#abaff382c6fd4b494ec0c17498d94919e">blmc_robots::BlmcJointModules::Vector</a></div><div class="ttdeci">Eigen::Matrix&lt; double, COUNT, 1 &gt; Vector</div><div class="ttdoc">Defines a static Eigen vector type in order to define the interface. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:328</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_abc94960666d33b6a5071d4cf25f7794d"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#abc94960666d33b6a5071d4cf25f7794d">blmc_robots::BlmcJointModules::set_zero_angles</a></div><div class="ttdeci">void set_zero_angles(const Vector &amp;zero_angles)</div><div class="ttdoc">Set the zero_angles. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:474</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_af739948e89e5192eb853c7c5dcb9e87f"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#af739948e89e5192eb853c7c5dcb9e87f">blmc_robots::BlmcJointModules::get_measured_angles</a></div><div class="ttdeci">Vector get_measured_angles() const </div><div class="ttdoc">Get the measured joint angles. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:441</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_a9c71bc7db0ff4cd08bc2686a244caa65"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#a9c71bc7db0ff4cd08bc2686a244caa65">blmc_robots::BlmcJointModules::get_sent_torques</a></div><div class="ttdeci">Vector get_sent_torques() const </div><div class="ttdoc">Get the previously sent torques. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:409</div></div>
<div class="ttc" id="namespaceblmc__robots_html_aa1075809042ff261e4b0a20d161448b6a43491564ebcfd38568918efbd6e840fd"><div class="ttname"><a href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6a43491564ebcfd38568918efbd6e840fd">blmc_robots::HomingReturnCode::RUNNING</a></div><div class="ttdoc">Homing is currently running. </div></div>
<div class="ttc" id="structblmc__robots_1_1HomingState_html_a770422e8764a847278e5353e2ebe57a6"><div class="ttname"><a href="structblmc__robots_1_1HomingState.html#a770422e8764a847278e5353e2ebe57a6">blmc_robots::HomingState::last_encoder_index_time_index</a></div><div class="ttdeci">long int last_encoder_index_time_index</div><div class="ttdoc">Timestamp from when the encoder index was seen the last time. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:53</div></div>
<div class="ttc" id="namespaceblmc__robots_html_aa1075809042ff261e4b0a20d161448b6ab9e14d9b2886bcff408b85aefa780419"><div class="ttname"><a href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6ab9e14d9b2886bcff408b85aefa780419">blmc_robots::HomingReturnCode::FAILED</a></div><div class="ttdoc">Homing failed. </div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_ab6a642e6939b8587189502e4b179fdcf"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#ab6a642e6939b8587189502e4b179fdcf">blmc_robots::BlmcJointModules::execute_homing</a></div><div class="ttdeci">HomingReturnCode execute_homing(double search_distance_limit_rad, Vector home_offset_rad, double profile_step_size_rad=0.001)</div><div class="ttdoc">Perform homing for all joints. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:555</div></div>
<div class="ttc" id="structblmc__robots_1_1HomingState_html_a72a681755f52b727ddca35e3811fa5f5"><div class="ttname"><a href="structblmc__robots_1_1HomingState.html#a72a681755f52b727ddca35e3811fa5f5">blmc_robots::HomingState::target_position_rad</a></div><div class="ttdeci">double target_position_rad</div><div class="ttdoc">Current target position of the position profile. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:57</div></div>
<div class="ttc" id="structblmc__robots_1_1HomingState_html_af821e232c974385ae24e20a7f75665f7"><div class="ttname"><a href="structblmc__robots_1_1HomingState.html#af821e232c974385ae24e20a7f75665f7">blmc_robots::HomingState::status</a></div><div class="ttdeci">HomingReturnCode status</div><div class="ttdoc">Current status of the homing procedure. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:59</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html">blmc_robots::BlmcJointModules</a></div><div class="ttdoc">This class defines an interface to a collection of BLMC joints. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:321</div></div>
<div class="ttc" id="namespaceblmc__robots_html_aa1075809042ff261e4b0a20d161448b6afd9f6519d3f45276829fe74eb2c4bb85"><div class="ttname"><a href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6afd9f6519d3f45276829fe74eb2c4bb85">blmc_robots::HomingReturnCode::SUCCEEDED</a></div><div class="ttdoc">Homing is succeeded. </div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_aeefc9487da9aafde41da790968a8165e"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#aeefc9487da9aafde41da790968a8165e">blmc_robots::BlmcJointModules::get_measured_torques</a></div><div class="ttdeci">Vector get_measured_torques() const </div><div class="ttdoc">Get the measured joint torques. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:425</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_a905addfe3271be5bc88bd785c5cbb032"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#a905addfe3271be5bc88bd785c5cbb032">blmc_robots::BlmcJointModules::set_motor_array</a></div><div class="ttdeci">void set_motor_array(const std::array&lt; std::shared_ptr&lt; blmc_drivers::MotorInterface &gt;, COUNT &gt; &amp;motors, const Vector &amp;motor_constants, const Vector &amp;gear_ratios, const Vector &amp;zero_angles, const Vector &amp;max_currents)</div><div class="ttdoc">Set the motor array, by creating the corresponding modules. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:362</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_a524fd41f808027190d59460a4787aea6"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#a524fd41f808027190d59460a4787aea6">blmc_robots::BlmcJointModules::set_position_control_gains</a></div><div class="ttdeci">void set_position_control_gains(Vector kp, Vector kd)</div><div class="ttdoc">Set position control gains for all joints. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:532</div></div>
<div class="ttc" id="structblmc__robots_1_1HomingState_html_ad8ffa51d7885e6e83dd4b32354184175"><div class="ttname"><a href="structblmc__robots_1_1HomingState.html#ad8ffa51d7885e6e83dd4b32354184175">blmc_robots::HomingState::home_offset_rad</a></div><div class="ttdeci">double home_offset_rad</div><div class="ttdoc">Offset from home position to zero position. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:49</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_a74910d81a89f9b1713ce8fecc69191fe"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#a74910d81a89f9b1713ce8fecc69191fe">blmc_robots::BlmcJointModules::BlmcJointModules</a></div><div class="ttdeci">BlmcJointModules(const std::array&lt; std::shared_ptr&lt; blmc_drivers::MotorInterface &gt;, COUNT &gt; &amp;motors, const Vector &amp;motor_constants, const Vector &amp;gear_ratios, const Vector &amp;zero_angles, const Vector &amp;max_currents)</div><div class="ttdoc">Construct a new BlmcJointModules object. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:338</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModule_html"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModule.html">blmc_robots::BlmcJointModule</a></div><div class="ttdoc">The BlmcJointModule class is containing the joint information. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:69</div></div>
<div class="ttc" id="namespaceblmc__robots_html_aa1075809042ff261e4b0a20d161448b6a02de9649e258d1dd94056e676061e969"><div class="ttname"><a href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6a02de9649e258d1dd94056e676061e969">blmc_robots::HomingReturnCode::NOT_INITIALIZED</a></div><div class="ttdoc">Homing was not initialized and can therefore not be performed. </div></div>
<div class="ttc" id="structblmc__robots_1_1HomingState_html"><div class="ttname"><a href="structblmc__robots_1_1HomingState.html">blmc_robots::HomingState</a></div><div class="ttdoc">State variables required for the homing. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:43</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_a4ca83d65d009aaafe4522d431490bb1d"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#a4ca83d65d009aaafe4522d431490bb1d">blmc_robots::BlmcJointModules::get_zero_angles</a></div><div class="ttdeci">Vector get_zero_angles() const </div><div class="ttdoc">Get the zero_angles. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:487</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_a26d4d675142bc783c1f983d135a41a09"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#a26d4d675142bc783c1f983d135a41a09">blmc_robots::BlmcJointModules::send_torques</a></div><div class="ttdeci">void send_torques()</div><div class="ttdoc">Send the registered torques to all modules. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:383</div></div>
<div class="ttc" id="common__header_8hpp_html"><div class="ttname"><a href="common__header_8hpp.html">common_header.hpp</a></div><div class="ttdoc">The hardware wrapper of the quadruped. </div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_a87320890796f67050faa4fa506d5142d"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#a87320890796f67050faa4fa506d5142d">blmc_robots::BlmcJointModules::get_measured_velocities</a></div><div class="ttdeci">Vector get_measured_velocities() const </div><div class="ttdoc">Get the measured joint velocities. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:457</div></div>
<div class="ttc" id="namespaceblmc__robots_html_aa5066dce11e2e3ae56b844676b132a09"><div class="ttname"><a href="namespaceblmc__robots.html#aa5066dce11e2e3ae56b844676b132a09">blmc_robots::BlmcJointModule_ptr</a></div><div class="ttdeci">std::shared_ptr&lt; BlmcJointModule &gt; BlmcJointModule_ptr</div><div class="ttdoc">BlmcJointModule_ptr shortcut for the shared pointer BlmcJointModule type. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:312</div></div>
<div class="ttc" id="namespaceblmc__robots_html_a1975c6bb47bc85dfc8edfe349c30dae1"><div class="ttname"><a href="namespaceblmc__robots.html#a1975c6bb47bc85dfc8edfe349c30dae1">blmc_robots::mi</a></div><div class="ttdeci">blmc_drivers::MotorInterface::MeasurementIndex mi</div><div class="ttdoc">mi, this typedef is used to get the measurements from the blmc api </div><div class="ttdef"><b>Definition:</b> common_header.hpp:80</div></div>
<div class="ttc" id="namespaceblmc__robots_html_aa1075809042ff261e4b0a20d161448b6"><div class="ttname"><a href="namespaceblmc__robots.html#aa1075809042ff261e4b0a20d161448b6">blmc_robots::HomingReturnCode</a></div><div class="ttdeci">HomingReturnCode</div><div class="ttdoc">Possible return values of the homing. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:28</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_ada76994634fd0f15fb5df311a61e97d7"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#ada76994634fd0f15fb5df311a61e97d7">blmc_robots::BlmcJointModules::set_position_control_gains</a></div><div class="ttdeci">void set_position_control_gains(size_t joint_id, double kp, double kd)</div><div class="ttdoc">Set position control gains for the specified joint. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:521</div></div>
<div class="ttc" id="structblmc__robots_1_1HomingState_html_a06b1c01870f9531cbe766728603f468b"><div class="ttname"><a href="structblmc__robots_1_1HomingState.html#a06b1c01870f9531cbe766728603f468b">blmc_robots::HomingState::profile_step_size_rad</a></div><div class="ttdeci">double profile_step_size_rad</div><div class="ttdoc">Step size for the position profile. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:51</div></div>
<div class="ttc" id="structblmc__robots_1_1HomingState_html_a3ce572a7b025bbdf1eaaa5b72dc11dde"><div class="ttname"><a href="structblmc__robots_1_1HomingState.html#a3ce572a7b025bbdf1eaaa5b72dc11dde">blmc_robots::HomingState::search_distance_limit_rad</a></div><div class="ttdeci">double search_distance_limit_rad</div><div class="ttdoc">Max. distance to move while searching the encoder index. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:47</div></div>
<div class="ttc" id="structblmc__robots_1_1HomingState_html_a61557c9cbddb3183ccccafc456a1a00f"><div class="ttname"><a href="structblmc__robots_1_1HomingState.html#a61557c9cbddb3183ccccafc456a1a00f">blmc_robots::HomingState::joint_id</a></div><div class="ttdeci">int joint_id</div><div class="ttdoc">Id of the joint. Just use for debug prints. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:45</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_ac7dba81727847238fc4c42b7dca6a0ea"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#ac7dba81727847238fc4c42b7dca6a0ea">blmc_robots::BlmcJointModules::set_torques</a></div><div class="ttdeci">void set_torques(const Vector &amp;desired_torques)</div><div class="ttdoc">Register the joint torques to be sent for all modules. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:396</div></div>
<div class="ttc" id="namespaceblmc__robots_html"><div class="ttname"><a href="namespaceblmc__robots.html">blmc_robots</a></div><div class="ttdef"><b>Definition:</b> blmc_joint_module.cpp:15</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_a0ef05c89eeb1ffde131f44d4f3a300c8"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#a0ef05c89eeb1ffde131f44d4f3a300c8">blmc_robots::BlmcJointModules::get_measured_index_angles</a></div><div class="ttdeci">Vector get_measured_index_angles() const </div><div class="ttdoc">Get the index_angles. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:503</div></div>
<div class="ttc" id="classblmc__robots_1_1BlmcJointModules_html_af4c700a8d346ceaebece38928b5e7ca6"><div class="ttname"><a href="classblmc__robots_1_1BlmcJointModules.html#af4c700a8d346ceaebece38928b5e7ca6">blmc_robots::BlmcJointModules::BlmcJointModules</a></div><div class="ttdeci">BlmcJointModules()</div><div class="ttdoc">Construct a new BlmcJointModules object. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:351</div></div>
<div class="ttc" id="structblmc__robots_1_1HomingState_html_a16adc4753efe03def5ef3ebf7abc632c"><div class="ttname"><a href="structblmc__robots_1_1HomingState.html#a16adc4753efe03def5ef3ebf7abc632c">blmc_robots::HomingState::step_count</a></div><div class="ttdeci">uint32_t step_count</div><div class="ttdoc">Number of profile steps already taken. </div><div class="ttdef"><b>Definition:</b> blmc_joint_module.hpp:55</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_80e6cdd9bbc895bd262b4f65e652822c.html">catkin</a></li><li class="navelem"><a class="el" href="dir_b7f9efe3285d4a585ae30572be0808b1.html">robots</a></li><li class="navelem"><a class="el" href="dir_ee86b8bcb6635cb36ad14bd888f09517.html">blmc_robots</a></li><li class="navelem"><a class="el" href="dir_ff3606c6e0aa43abff10c4365bd5a19c.html">include</a></li><li class="navelem"><a class="el" href="dir_c66acd4681b95343b3d51cde3fc288b6.html">blmc_robots</a></li><li class="navelem"><a class="el" href="blmc__joint__module_8hpp.html">blmc_joint_module.hpp</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
